package com.godpaper.as9.commands
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.godpaper.as9.bussiness.delegates.PhotoDelegate;
	import com.godpaper.as9.events.GetThumbnailListEvent;
	import com.godpaper.as9.model.PhotoModelLocator;
	
	import mx.collections.ArrayCollection;
	import mx.rpc.IResponder;

	public class GetThumbnailListCommand extends CommandBase implements ICommand, IResponder
	{
		private var delegate:PhotoDelegate;
		private var photoModel:PhotoModelLocator = PhotoModelLocator.getInstance();
		private var getThumbnailListEvent:GetThumbnailListEvent;
		public function GetThumbnailListCommand()
		{
			super();
			delegate = new PhotoDelegate(this);
		}
		
		override public function execute(event:CairngormEvent):void
		{
			getThumbnailListEvent = GetThumbnailListEvent(event);
			
			delegate.getThumbnailList();
		}
		
		override public function result(data:Object):void
		{
			trace(data.result);
			if(data.result)
			{
				photoModel.thumbnailList = data.result;
			}
		}
		
		
	}
}